//
//  TabBarViewController.m
//  EverydayDemo
//
//  Created by qianfeng01 on 15-7-17.
//  Copyright (c) 2015年 qianfeng01. All rights reserved.
//

#import "TabBarViewController.h"
#import "BaseViewController.h"
@interface TabBarViewController ()

@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createControllers];
    self.view.backgroundColor=[UIColor colorWithRed:235/255 green:235/255 blue:235/255 alpha:0.1];
}
-(void)createControllers
{
     NSString *path=[[NSBundle mainBundle]pathForResource:@"ControllersList" ofType:@"plist"];
    NSArray *fileArr=[NSArray arrayWithContentsOfFile:path];
    NSMutableArray *vcArr=[[NSMutableArray alloc]init];
    for (NSDictionary *dic in fileArr) {
        NSString *title=dic[@"title"];
        NSString *iconImage=dic[@"IconImage"];
        NSString *className=dic[@"controller"];
        NSString *selectedImage=dic[@"selectedImage"];
        Class cls=NSClassFromString(className);
        BaseViewController *base=[[cls alloc]init];
        UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:base];
        base.title=title;
        nav.tabBarItem.image=[UIImage imageNamed:iconImage];
        nav.tabBarItem.selectedImage=[[UIImage imageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        //使导航栏透明
        UIImage *image=[UIImage imageNamed:@"back.png"];
       [nav.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
        [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
        //设置导航栏字体颜色
       nav.navigationBar.barStyle = UIBarStyleBlackTranslucent;
        [nav.navigationBar setShadowImage:image];
        base.title=title;
        [vcArr addObject:nav];
    }
    self.viewControllers=vcArr;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
